﻿using Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.Configers
{
    public class CFTKConfiger : IEntityTypeConfiguration<CFTK>
    {
        public void Configure(EntityTypeBuilder<CFTK> builder)
        {
            builder.ToTable(nameof(CFTK));
            builder.Property(x => x.FirstKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.FirstKindName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.SecondKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.SecondKindName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.ThirdKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.ThirdKindName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.ThirdSaleId).IsRequired(false);
            builder.Property(x => x.ThirdKindIf).IsRequired(false).HasMaxLength(2);

            builder.HasData(new CFTK()
            {
                FtkId = 1,
                FirstKindId = "01",
                FirstKindName = "集团",
                SecondKindId = "01",
                SecondKindName = "软件公司",
                ThirdKindId = "01",
                ThirdKindName = "外包组",
                ThirdSaleId = "01",
                ThirdKindIf = "否"
            }, new CFTK()
            {
                FtkId = 2,
                FirstKindId = "01",
                FirstKindName = "集团",
                SecondKindId = "02",
                SecondKindName = "生物科技有限公司",
                ThirdKindId = "01",
                ThirdKindName = "药店",
                ThirdSaleId = "01",
                ThirdKindIf = "是"
            }
            );
        }
    }
}
